﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="FAQ.ascx.cs" Inherits="UserControls_FAQ" %>
<%@ Import Namespace="BLL" %>
<script runat="server">
    CategoryBLL cateData = new CategoryBLL();
    ArticleBLL articData = new ArticleBLL();
</script>
                            <% 
                                
                                int size = 5;
                                int countItem;
                                string heading = cateData.GetById(11).Name;
                                var listArtic = articData.GetByCategory(11, true, pages, 5, out countItem);
                                int count = 1;
                                int coutnPage = countItem / size;
                                if (countItem % size != 0)
                                    coutnPage++;
                                %>

                            <div id="headding">
								<ul>
									<li><%=heading %></li>
								</ul>
							</div><!--End #headding-->
							<div id="listTuVan">
								<ul>
                                <%
                                    if (listArtic.Count >= 1)
                                    {
                                        foreach (var item in listArtic)
                                        {
                                            string images = item.Image;
                                            if (images == null) images = "hoi-dap.jpg";
                                            string title = item.Title;
                                            string date = item.CreateDate.ToShortDateString();
                                            string description = Myfunction.SubString(item.Description, 20, "...");
                                            string url = "/ArticlesDetails.aspx?Id=" + item.Id;
                                            %>
                                                <li>
										            <div class="image">
											            <a href="<%=url %>"><img src="/Images/Article/<%=images %>" alt="" title="" /></a>
										            </div>
										            <div class="detail">
											            <a href="<%=url %>"><p class="title"><%=title%></p></a>
											            <p><%=description%></p>
										            </div>
									            </li>
                                            <%
                                    }
                                    }
                                    else
                                    { 
                                        %>
                                            <p class="note">Dữ liệu đang cập nhật...</p>
                                        <%
                                        
                                    }
                                     %>
								</ul>
                                <%
                                if (coutnPage > 1)
                                { 
                                    %>
                                    <ul class="page">
									        <li>Trang: </li>
                                            <%
                                                for (int i = 1; i <= coutnPage; i++)
                                                {
                                                    //string url = "NewsCategory.aspx?Id=" + CateId + "&Page=" + i.ToString();
                                                    if (i == pages)
                                                    { 
                                                    %>
                                                    <li class="active"><p><%=i.ToString()%></p></li>
                                                    <%
                                                    }
                                                    else
                                                    { 
                                                    %>
                                                    <li onclick="LoadAjax();"><a class="now" ><%=i.ToString()%></a></li>
                                                    <%
                                                    }
                                                }
                                                 %>
									        
									        
							        </ul>
                                    <%
                                }
                                 %>


							</div>
							<div id="godetail">
								
							</div>